package com.hotel.services.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hotel.daos.DeptMapper;
import com.hotel.entitys.Dept;
import com.hotel.services.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;

@Service
@Transactional
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;

    //删除所有部门信息
    @Override
    public int deleteDeptBydept_Id(Integer dept_id) {
        return deptMapper.deleteDeptBydept_id(dept_id);
    }
//添加部门信息
    @Override
    public int addDept(Dept dept) {
        return deptMapper.addDept(dept);
    }
    //修改部门信息
    @Override
    public int updateDept(Dept dept) {
        return deptMapper.updateDept(dept);
    }
    //查询部门
    @Override
    public List<Dept> getAllDept(String keyWord) {
        return deptMapper.selectAllDept(keyWord);
    }

    @Override
    public List<Dept> getAllDepts() {
        return deptMapper.selectAllDepts();
    }

    @Override
    public Dept getOneDept(Integer dept_id) {
        return deptMapper.selectDeptById(dept_id);
    }


}
